angular.module('select-url',[]).component("selectUrl",{
	templateUrl:"utilUrl/select.html",
	controllerAs:"Ctrl",
	 controller:confirmDialogController,
	  bindings:{
	 	itemArray:'<',
	 	selected:"=",
	 	value:"="
	 }

})
confirmDialogController.$inject = ['$log','$scope','$http','$timeout'];
function confirmDialogController($log,$scope,$http,$timeout) {
	var vm=this
	setTimeout(function (){
			$scope.itemArray=vm.itemArray
			$scope.selected=vm.value
	},300)
 	
	//定义定时器变量
	var timeout;
	$scope.orderNameChange=function(){
	    //如果定时器已经有值了则取消当前定时器
	    if(timeout){
	        $timeout.cancel(timeout)
	    }
	    //设置定时器,延迟200毫秒
	    timeout=$timeout(function(){
	        //做向后台查询的动作
	        $scope.$watch('selected.value', function (newValue ,oldValue) {
		 	if (newValue === oldValue)return;
					$scope.selected=vm.value
					vm.selected=newValue
       })
	    },300)
	}
	$scope.orderNameChange()
		 
	
	
}